package com.demo.chatback.controller;

import com.demo.chatback.api.CommonController;
import com.demo.chatback.api.CommonResult;
import com.demo.chatback.pojo.User;
import com.demo.chatback.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author 小王八
 * @since 2022-12-31
 */
@RestController
@RequestMapping("/user")
public class UserController extends CommonController {
    @Autowired
    private UserService userService;

    @GetMapping("/getUserInfoById")
    public CommonResult<User> getUserInfoById(@RequestParam Long userId){
        return process(()->userService.queryUserById(userId));
    }

    @GetMapping("/getUserInfoByTele")
    public CommonResult<User> getUserInfoByTele(@RequestParam String telephone){
        return process(()->userService.queryUserByTele(telephone));
    }
}
